<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ include file="../common/include/header.jsp" %>
<div width="980px">
<script type="text/javascript">
	
	
	function getSearch(value)
	{
		document.communityActionForm.method.value = value;
		document.communityActionForm.submit();//검색요청한다.
	}
	
	
	
	function getInsertMove(cono)
	{
		
		document.communityActionForm.method.value = "modify";
		document.communityActionForm.submit();//엡데이트 요청
		//document.location.href  = "./insertcommunity.do?method=init&cono="+cono;
	}
	
	
	/*
	해당 커뮤니티를 활성화
	*/
	function UpdateCommunity(cono,coopen)
	{
		if(confirm("해당 커뮤니티를 승인 하겠습니까?"))
		{
			document.communityActionForm.cono.value = cono;
			document.communityActionForm.coopen.value = coopen;
			document.communityActionForm.method.value = "modify";
			
			//엡데이트 요청	
			document.communityActionForm.submit();
		}
		return;
	}
	
	/*
	해당 커뮤니티를 삭제
	*/
	function DeleteCommunity(cono)
	{
		if(confirm("해당 커뮤니티를 삭제 하겠습니까?"))
		{
			document.communityActionForm.cono.value = cono;
			document.communityActionForm.method.value = "delete";
			
			//엡데이트 요청	
			document.communityActionForm.submit();
		}
		return;
	}
	
	
</script>
<table style="width: 980px;" cellpadding="0" cellspacing="0">
	<tr>
		<td style="width: 180px;vertical-align: top;background: #e76969;">
			<!-- 메뉴화면 -->
			<%@ include file="./menu.jsp" %>
		</td>
		<td style="width: 800px;vertical-align: top;text-align: center;">
			<!-- 실제 컨텐츠 화면 표시부분 -->
			<html:form action="/community" method="post">
			
			<input type="hidden" name="method" value=""/>
			<input type="hidden" name="cono" value=""/>
			<input type="hidden" name="coopen" value=""/>
			
			<html:hidden property="totalCount"/>
			
			
<div style="height: 10px;"></div>
			<!-- 커뮤니티정보부 -->
		<table style="width: 700px;border: 1px solid #e76969;"><tr><td style="padding: 10px;">
			<table style="width: 600px;border: 1px solid #e76969;" cellpadding="2"  cellspacing="1">
				<tr>
					<td colspan="2" style="width: 600px;height: 20px;background: #e76969;color: white;font-weight: bold;">커뮤니티검색</td></tr>
				<tr>
					<td colspan="2" style="height: 20px;text-align: center;"><span style="font-weight: bold;">개설 커뮤니티 :</span>
					<span style="font-size: 8pt;color: #e76969;"><bean:write name="communityActionForm" property="totalCount"/></span>
					<span style="font-size: 8pt;color: #aaaaaa;">&nbsp;개의 커뮤니티가 개설되어 있습니다.</span></td>
				</tr>
				<tr>
					<td style="width: 300px;height: 20px;">커뮤니티명</td>
					<td style="width: 300px;height: 20px;">
					<html:select property="search_community" style="height: 18px;font-size: 8pt;width: 200px;">
						<html:optionsCollection property="communityInfo" value="cono" label="coname"/>
					</html:select>
					<html:button property="" value="검색" onclick="getSearch('search');" styleClass="adminSearch"></html:button>
					</td>
				</tr>
			</table>

			
<div style="height: 10px;"></div>
			<!-- 커뮤니티정보표시부 -->
			<logic:notEmpty property="community" name="communityActionForm">
				<table style="width: 600px;border: 1px solid #e76969;background: #ffe3e3;" cellpadding="2"  cellspacing="1">
					<tr>
						<td colspan="2" style="width: 600px;background: #e76969;color: white;height: 20px;font-weight: bold;">커뮤니티 기본정보</td>
					</tr>
					<tr>
						<td class="adminTd1" style="width: 200px;">커뮤니티명</td>
						<td class="adminTd1" style="width: 400px;"><bean:write name="communityActionForm" property="community.coname" /></td>
					</tr>
					<tr>
						<td class="adminTd1">등록일자</td>
						<td class="adminTd1"><bean:write name="communityActionForm" property="community.coregdate" /></td>
					</tr>
					<tr>
						<td class="adminTd1">설명</td>
						<td class="adminTd1"><bean:write name="communityActionForm" property="community.coguide" /></td>
					</tr>
					<tr>
						<td class="adminTd1">카테고리</td>
						<td class="adminTd1"><bean:write name="communityActionForm" property="communityName" /></td>
					</tr>
					<tr>
						<td class="adminTd1">등록회원수</td>
						<td class="adminTd1"><bean:write name="communityActionForm" property="memberCount" />&nbsp;명</td>
					</tr>
				</table>

<div style="height: 10px;"></div>				
				<logic:notEmpty name="communityActionForm" property="community.communityLinks">
					<table style="width: 400px;border: 1px solid #e76969;" cellpadding="2" cellspacing="1">
						<tr>
							<td colspan="2" style="height: 20px;background: #e76969;color: white;font-weight: bold;">커뮤니티 링크정보</td>
						</tr>
						<tr>
							<td class="adminTd1" style="width: 150px;font-weight: bold;">링크명</td>
							<td class="adminTd1" style="font-weight: bold;">링크주소</td>
						</tr>
						<logic:iterate id="comlink" name="communityActionForm" property="community.communityLinks" type="model.CommunityLink">
							<tr>
								<td><bean:write name="comlink" property="linkname" /></td>
								<td><bean:write name="comlink" property="linkaddress" /></td>
							</tr>
						</logic:iterate>
					</table>
				</logic:notEmpty>
				<logic:empty name="communityActionForm" property="community.communityLinks">
					<logic:notEmpty name="communityActionForm" property="community.coname">
						<bean:write name="communityActionForm" property="community.coname" /> 커뮤니티의 링크정보는 없습니다.
					</logic:notEmpty>
					
				</logic:empty>
			</logic:notEmpty>
						
		</td></tr></table>

<div style="height: 10px;"></div>
			<!-- 커뮤니티 신규 작성 -->
			<!-- 현재 대기 하고 있는 커뮤니티 표시 ---------------------------------------------------- -->
			<logic:notEmpty property="holdonCommunitys" name="communityActionForm">
			<table style="width: 700px;border: 1px solid #e76969;" cellpadding="2" cellspacing="1">
				<tr><td colspan="8" style="color: white;background: #e76969;text-align: center;font-weight: bold;height: 20px;">개설 대기 커뮤니티</td></tr>
				<tr>
					<td class="adminTd2" style="width: 30px;">NO</td>
					<td class="adminTd2" style="width: 100px;">커뮤니티이름</td>
					<td class="adminTd2">커뮤니티설명</td>
					<td class="adminTd2" style="width: 100px;">신청자</td>
					<td class="adminTd2" style="width: 70px;">등록일시</td>
					<td class="adminTd2" style="width: 30px;">상태</td>
					<td class="adminTd2" style="width: 50px;">승인</td>
					<td class="adminTd2" style="width: 50px;">삭제</td>
				</tr>
			<logic:iterate id="Community" name="communityActionForm" property="holdonCommunitys" type="model.Community">
				<tr>
					<td class="adminTd1"><bean:write name="Community" property="cono"/></td>
					<td class="adminTd1"><bean:write name="Community" property="coname"/></td>
					<td class="adminTd1"><bean:write name="Community" property="coguide"/></td>
					<td class="adminTd1"><bean:write name="Community" property="masterid"/>(<bean:write name="Community" property="masternickname"/>)</td>
					<td class="adminTd1"><bean:write name="Community" property="coregdate"/></td>
					<td class="adminTd1"><bean:write name="Community" property="coopen"/></td>
					<td class="adminTd1"><input type="button" value="승인" onclick="javascript:UpdateCommunity('<bean:write name="Community" property="cono"/>','<bean:write name="Community" property="coopen"/>');" class="adminBtnCnf"/></td>
					<td class="adminTd1"><input type="button" value="삭제" onclick="javascript:DeleteCommunity('<bean:write name="Community" property="cono"/>');" class="adminBtnCnf"/></td>
					
				</tr>	
			</logic:iterate>
			</table>
			</logic:notEmpty>
			<!-- 현재 대기하고 있는 커뮤니티가 없을때는 그냥 표시 안한다. -->
			<logic:empty  property="holdonCommunitys" name="communityActionForm">
			※미등록 커뮤니티 없음.
			</logic:empty>
			<!-- --------------------------------------------------------------------------------------- -->
			</html:form>
		</td>
	</tr>
</table>
</div>
<%@ include file="../common/include/footer.jsp" %>